from django.db import models
from datetime import datetime
# Create your models here.

# class Admin(models.Model):
#     """
#     管理员数据表
#     """
#     username=models.CharField(max_length=20)
#     password=models.CharField(max_length=36)
#     createtime=models.DateTimeField(default=datetime.now())
#     lastlogintime=models.DateTimeField(auto_now=True)#每次更新数据记录的时候都会更新该字段，用来记录上一次登陆时间
#     roleid=models.CharField(default=1,max_length=10)
#     logincount=models.IntegerField(default=0)
#     status=models.BooleanField(default=1)#是否停用
#     class Meta:
#         db_table="admin"

class UserInfo(models.Model):
    """
    用户信息数据表
    """
    username=models.CharField(max_length=20)
    headimg = models.CharField(max_length=255,blank=True)
    createtime=models.DateTimeField(default=datetime.now())
    tel=models.CharField(max_length=11,blank=True)
    lastlogintime=models.DateTimeField(auto_now=True)#每次更新数据记录的时候都会更新该字段，用来记录上一次登陆时间
    class Meta:
        db_table="userinfo"

class Carousel(models.Model):
    """
    轮播图片
    """
    img_src=models.CharField(max_length=150)
    class Meta:
        db_table="carousel"

class Product_cate(models.Model):
    """
    商品分类
    """
    cate_name=models.CharField(max_length=30)
    class Meta:
        db_table="product_cate"

class Product_list(models.Model):
    """
    商品数据
    """
    cate_id=models.IntegerField(default=0)
    img_src=models.CharField(max_length=150)
    title=models.CharField(max_length=100)
    price=models.FloatField()
    sellnum=models.IntegerField()
    count=models.IntegerField(blank=True)
    class Meta:
        db_table="product_list"

class Product_detail(models.Model):
    """
    商品详情
    """
    goods_id=models.IntegerField()
    img_src=models.CharField(max_length=255)
    content=models.CharField(max_length=100)
    detail=models.TextField(blank=True)#用于富文本编辑，暂时为空
    class Meta:
        db_table="product_detail"

class Product_carousel(models.Model):
    """
    商品详情页轮播图
    """
    goods_id=models.IntegerField()
    img_src=models.CharField(max_length=255)
    class Meta:
        db_table="product_carousel"


# class Comment(models.Model):
#     """
#     用户评价
#     """
#     user_id=models.IntegerField()
#     goods_id=models.IntegerField()
#     content=models.CharField(max_length=255)
#     price=models.FloatField()
#     sellnum=models.IntegerField()
#     count=models.IntegerField()
#     class Meta:
#         db_table="comment"

